#include <bits/stdc++.h>
// 2025/07/24
// tag: 
// Author: Forever
using namespace std;
int n, ans, grid[15];

int lowbit(int x)
{
    return x & (-x);
}

void dfs(int i, int line, int l, int r)
{
    if (line == (1 << n) - 1) {
        ans++;
        return;
    }
    int x = (1 << n) - 1 & ~(grid[i] | line | l | r);
    while (x) {
        int t = lowbit(x);
        x -= t;
        dfs(i + 1, line | t, (l | t) << 1, (r | t) >> 1);
    }
}

signed main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    cin >> n;
    char c;
    for (int i = 0; i < n; i++)
        for (int j = 0; j < n; j++) {
            cin >> c;
            if (c == '.')
                grid[i] |= (1 << j);
        }
    dfs(0, 0, 0, 0);
    cout << ans << endl;
    return 0;
}